package com.example.myapplication.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.example.myapplication.R;

public class BlankFragment2 extends Fragment {

    private  View root;
    private TextView textView;
    private Button btn;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if(root==null){
            root = inflater.inflate(R.layout.fragment_blank1,container,false);
        }
        textView = root.findViewById(R.id.blank_textView);
        btn = root.findViewById(R.id.blank_btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                textView.setText("好的很。");
            }
        });
        return root;
    }
}